package javacafe.action.factory;

import javacafe.action.Action;
import javacafe.action.ActionFactory;
import javacafe.action.studybbs.CreateBBSAction;
import javacafe.action.studybbs.DeletePostAction;
import javacafe.action.studybbs.DeleteReplyAction;
import javacafe.action.studybbs.InsertPostAction;
import javacafe.action.studybbs.InsertReplyAction;
import javacafe.action.studybbs.ReadPostAction;
import javacafe.action.studybbs.ReplyListAction;
import javacafe.action.studybbs.UpdatePostAction;
import javacafe.action.studybbs.UpdatePostFormAction;
import javacafe.action.studybbs.UpdateReplyAction;
import javacafe.action.studybbs.WriteFormAction;
import javacafe.action.studybbs.ListAction;
import javacafe.action.studybbs.StudyBBSMgrAction;
import javacafe.action.studybbs.UpdateBBSAction;

public class StudyBBSActionFactory implements ActionFactory {
	
	private static ActionFactory factory;
	
	public StudyBBSActionFactory(){
		super();
	}
	
	public static ActionFactory getInstance(){
		if (factory == null) {
			factory = new StudyBBSActionFactory();
		}
		return factory;
	}
	
	@Override
	public Action getAction(String command) {
		Action action = null;
		
		if (command.contentEquals("list")) {
			action = new ListAction();
		}else if (command.equalsIgnoreCase("writeform")) {
			action = new WriteFormAction();
		}else if (command.equalsIgnoreCase("bbsmgr")) {
			action = new StudyBBSMgrAction();
		}else if (command.equalsIgnoreCase("createbbs")) {
			action = new CreateBBSAction();
		}else if (command.equalsIgnoreCase("updatebbs")) {
			action = new UpdateBBSAction();
		}else if (command.equalsIgnoreCase("insertpost")) {
			action = new InsertPostAction();
		}else if (command.equalsIgnoreCase("readpost")) {
			action = new ReadPostAction();
		}else if (command.equalsIgnoreCase("insertreply")) {
			action = new InsertReplyAction();
		}else if (command.equalsIgnoreCase("replylist")) {
			action = new ReplyListAction();
		}else if (command.equalsIgnoreCase("updatereply")) {
			action = new UpdateReplyAction();
		}else if (command.equalsIgnoreCase("deletereply")) {
			action = new DeleteReplyAction();
		}else if (command.equalsIgnoreCase("updatepostform")) {
			action = new UpdatePostFormAction();
		}else if (command.equalsIgnoreCase("updatepost")) {
			action = new UpdatePostAction();
		}else if (command.equalsIgnoreCase("deletepost")) {
			action = new DeletePostAction();
		}
		
		return action;
	}

}
